\section{mean --- Average value}
\label{fn:mean}
\index{mean()}
\index{average value}
\index{mean}
\begin{rail}
Mean : 'mean' '(' Matrix ')' ;
\end{rail}

\verb+mean+ calculates the arithmetic mean of the argument.  If the 
argument is a row or column vector, then the mean of all elements is
returned,  Otherwise \verb+mean+ returns a row matrix formed by taking
the arithmetic mean of each column.

$\Longrightarrow$ This is not an \RLaB\ built-in function.  This function
is normally loaded on start-up from the \verb+mean.r+ file in the
standard \verb+rlib+ directory. Use of the \verb+-r+ option, incorrectly 
setting the \verb+RLAB_LIB_DIR+ environmental variable, or modifying
\verb+mean.r+ may make this function unavailable.

\paragraph{Example}
\index{example of mean()}
\index{mean()!example}
\begin{verbatim} 
> a = rand(3,5)
 a =
    0.572      0.109      0.929      0.281      0.436  
    0.576      0.902      0.935      0.972      0.625  
    0.501      0.568      0.771     0.0269      0.469  
> mean(a)
     0.55      0.526      0.878      0.427       0.51  
> b = a[1;]
 b =
    0.572      0.109      0.929      0.281      0.436  
> mean(b)
    0.465
> c = a[;1]
 c =
    0.572  
    0.576  
    0.501  
> mean(c)
     0.55
\end{verbatim}

See also: Page~\pageref{fn:std} \verb+std()+.

\newpage





